Repository navigation
fix(obslist): keep compound designations apart in name resolution - #673
Merged
Merged
Conversation
An imported observing list's "M 2-9" (the Twin Jet, a Minkowski
planetary nebula) resolved to M 29. resolve_by_name keyed the name
index on ui_utils.normalize(), which strips spaces and hyphens, so a
compound designation collapsed into another catalog's sequence.
_name_key() keys it on the normalized name and its digit groups, so
"M 2-9" (2, 9) stays apart from "M 29" (29). "Sh 2-71" and "Sh2 71"
(2, 71), and "NGC 0497" and "NGC 497" (497,), still match.
Against the committed database, this also stops "M 3-2" resolving to
M 32, "M 1-1" to M 11, "NGC 650-1" to NGC 6501 and "Hu 1-2" to the
double star Hu 12. It separates five pairs of names on different
objects that normalize() collapsed, such as South 291 ("Sh 291") and
Sharpless 91 ("Sh2 91").
One form stops matching: an unspaced name whose catalog code ends in a
digit. "Sh2155" now has the digit groups (2155,), where the catalog's
"Sh2 155" has (2, 155).
Extracted from mrosseel's #379 (squash commit 954a83c on nixos) with
his agreement. It is adapted to main, whose name index maps a name to
the object, where nixos's maps it to a function that returns the
object.
Co-authored-by: mrosseel <mike.rosseel@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brickbots
added a commit
that referenced
this pull request
Nov 10, 2026
…t's parser (#693) * fix(obslist): read observing-list designations with the catalog import's parser Fault 6 of mrosseel's review on #670: the observing-list lookup had its own parser, so "H 24" (a double star) resolved to Herschel 400 #24, "Cr 399" resolved to nothing and "Collinder 399" resolved to a Lyngå object. - Move parse_designation, CATALOG_CODE_ALIASES and listing_named into the runtime-safe PiFinder/designations.py; catalog_import_utils re-exports them. - obslist_formats reads every designation (and CSV/NexTour catalog columns) through parse_designation, so ObsListEntry.catalog_code is always a PiFinder catalog code. The native format's key stays an exact lookup. - obslist resolves SkySafari catalog numbers with listing_named; the CATALOG_ALIASES and SKYSAFARI_CATALOG_NAMES maps are gone. - The name lookup (#673's _name_key) keeps its cases ("M 2-9" is not M 29, "NGC 0497" is NGC 497) but refuses a bare A/B/H designation (is_ambiguous_designation), which sources use for different objects. - Catalog CONTEXT.md and the obslist-formats README describe the shared parser. Refs #670, #673. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(obslist): save Herschel 400 and Barnard objects as designations that read back PiFinder saves observing lists as SkySafari files with "<code> <seq>". The shared parser refuses a bare "H 24" or "B 33" (double stars in SAC and WDS), so a saved list would lose those objects' catalog identity on reload. write_skylist now writes designations.designation(): "Herschel 24" and "Barnard 33"; other catalogs are unchanged. WDS has no readable designation and still saves by name. Refs #670. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
15 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An imported observing list's "M 2-9" resolves to M 29. M 2-9 is the Twin Jet, a Minkowski planetary nebula.
resolve_by_namekeys its name index onui_utils.normalize(), which strips spaces and hyphens, so "M 2-9" and "M 29" both becomem29.This is mrosseel's fix from #379 (squash commit
954a83c46onnixos), extracted with his agreement._name_key()and the two new tests are his._build_name_indexand the existing tests differ only wheremain's index maps a name to the object andnixos's maps it to a function that returns the object. So when #379 rebases, expect a small conflict in_build_name_indexand in the test index literals, rather than a clean drop-out.#671 fixes the same class of bug in the catalog import, where
ObjectFinderalso matched aliases throughnormalize(). This PR is the runtime half and doesn't depend on it.The fix
_name_key()keys the name index on the normalized name and its digit groups:m29, (2, 9))m29, (29,))sh271, (2, 71))ngc497, (497,))Text search, T9 search, the exact-name map in
catalogs.pyandcat_imagesdon't strip hyphens before matching one name, so they don't have this bug.Effect on the committed database
Checked by keying every name in
pifinder_objects.dbboth ways.normalize()collapsed, where the index kept whichever came first:Testing
All sessions ran on Python 3.9.
nox -s lint: all checks passed, andruff format --checkfinds nothing to reformat.nox -s type_hints: no issues in 153 source files.nox -s smoke_tests: 5 passed.nox -s unit_tests: 1528 passed. This includes the two new cases intests/test_obslist_resolve.py.🤖 Generated with Claude Code